package top.jolyoulu.webcommon.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskBootStrap;
import top.jolyoulu.corecommon.queue.delayed.DelayedTaskProducer;
import top.jolyoulu.corecommon.queue.delayed.observer.DelayedTaskSubject;

/**
 * @Author: JolyouLu
 * @Date: 2023/4/15 19:26
 * 内置的延迟队列操作配置
 */
@Configuration
public class DelayedQueueConfig {


    @Bean
    public DelayedTaskProducer delayedTaskProducer(){
        return new DelayedTaskProducer();
    }

    @Bean
    public DelayedTaskSubject delayedTaskSubject(){
        return new DelayedTaskSubject();
    }

    @Bean
    public DelayedTaskBootStrap delayedTaskConsumer(DelayedTaskProducer delayedTaskProducer,DelayedTaskSubject taskSubject){
        return new DelayedTaskBootStrap(1, delayedTaskProducer, taskSubject);
    }

}
